/**
 * 
 */
package com.sb.money.services;

import com.sb.money.exception.MoneyServiceException;

import java.io.Serializable;
import java.util.List;

/**
 * @author Stefan Bertos
 * @param <E>
 *            entity name
 */
public abstract interface AbstractService<E extends Serializable> {
    /**
     * Create new entity.
     * 
     * @param entity
     *            to create
     * @return created entity
     * @throws MoneyServiceException
     *             to throw
     */
    E create(E entity) throws MoneyServiceException;

    /**
     * update entity.
     * 
     * @param entity
     *            to update
     * @throws MoneyServiceException
     *             to throw
     */
    void update(E entity) throws MoneyServiceException;

    /**
     * delete entity.
     * 
     * @param entity
     *            to delete
     * @throws MoneyServiceException
     *             to throw
     */
    void delete(E entity) throws MoneyServiceException;

    /**
     * @return List of entitities
     * @throws MoneyServiceException
     *             to throw
     */
    List<E> findAll() throws MoneyServiceException;
}